eststo clear


if("`c(os)'"=="Windows"){
	local tableSaveDir = "Tables\"
	local plotSaveDir = "Plots\"
	local pythonSaveDir = "PythonScripts\"
}
else{
	local tableSaveDir = "Tables/"
	local plotSaveDir = "Plots/"
	local pythonSaveDir = "PythonScripts/"
}

//Establish Control Variable Sets
//Spec1 controls are the same for both registrations and VMT 
local spec1Controls = "c.normYear#i.stateGroup c.quadYear#i.stateGroup asinhMetroPop asinhNonMetroPop asinhMetroInc asinhNonMetroInc logrealmeangasprice logemployment loglicenseddrivers logrealstategdp logroadmileage"
local spec1LinearControls = "c.normYear#i.stateGroup asinhMetroPop asinhNonMetroPop asinhMetroInc asinhNonMetroInc logrealmeangasprice logemployment loglicenseddrivers logrealstategdp logroadmileage"

//Other controls are not the same for both registrations and VMT 
//Registration Controls
local spec2RegControls = "`spec1Controls' i.transactionDataDummy"
local spec3RegControls = "`spec2RegControls' i.regDummyExtSpec3"
local spec4RegControls = "`spec2RegControls' i.regDummyExtSpec4"

local spec2RegLinearControls = "`spec1LinearControls' i.transactionDataDummy"
local spec3RegLinearControls = "`spec2RegLinearControls' i.regDummyExtSpec3"
local spec4RegLinearControls = "`spec2RegLinearControls' i.regDummyExtSpec4"


di "`spec3RegControls'"

//Gas use Controls
local spec2GasUseControls = "`spec1Controls'"
local spec3GasUseControls = "`spec2GasUseControls' i.gasUseDummyExtSpec3"
local spec4GasUseControls = "`spec2GasUseControls' i.gasUseDummyExtSpec4"

local spec2GasUseLinearControls = "`spec1LinearControls'"
local spec3GasUseLinearControls = "`spec2GasUseLinearControls' i.gasUseDummyExtSpec3"
local spec4GasUseLinearControls = "`spec2GasUseLinearControls' i.gasUseDummyExtSpec4"

//Absorb Vars are always time and state fixed effects
local absorbVars = "ib51.stateGroup ib1995.year"

//Establish Cluster Variable
local clusterVar = "stateGroup year"
// local clusterVar = "stateGroup"

//Establish primary null
local primaryNull = 11
local altNull = round(9.7, .1)
local altNull2 = 1
local altNull3 = -4.8
local altNull4 = -6.1

local treatmentVar = "1.nosafetyind"

local fsOut = "logregistrations"
local rfOut = "loghighwaygasuse"

local fsOutPerCapita = "logRegPerCapita"
local rfOutPerCapita = "logGasUsePerCapita"

local fsControlsSpec1 = "`spec1Controls'"
local rfControlsSpec1 = "`spec1Controls'"

local fsControlsSpec1Linear = "`spec1LinearControls'"
local rfControlsSpec1Linear = "`spec1LinearControls'"

local treatControl = "nosafetyind"

local modelTitleSpec1 = "Spec1GasUse"
local modelTitleSpec1PerCapita = "Spec1GasUsePerCapita"
local modelTitleSpec1Linear = "Spec1GasUseLinear"
local nullLowSpec1 = -3.6
local nullDeltaSpec1 = 0.001
local nullHighSpec1 = 1

local fsControlsSpec2 = "`spec2RegControls'"
local rfControlsSpec2 = "`spec2GasUseControls'"

local fsControlsSpec2Linear = "`spec2RegLinearControls'"
local rfControlsSpec2Linear = "`spec2GasUseLinearControls'"

local treatControl = "nosafetyind"

local modelTitleSpec2 = "Spec2MultiClusterGasUse"
local nullLowSpec2 = -4
local nullDeltaSpec2 = 0.001
local nullHighSpec2 = 1

runModelFWL `fsOut', `rfOut', `fsControlsSpec2', `rfControlsSpec2', `treatControl', `absorbVars', `clusterVar', `treatmentVar', `modelTitleSpec2', `nullLowSpec1', `nullDeltaSpec1', `nullHighSpec1', `primaryNull', `altNull', `altNull2', `altNull3', `altNull4'
